package com.adou.multi.domain.entiry;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.annotations.GenericGenerator;

import com.adou.multi.multi_tenancy.domain.entity.AbstractBaseEntity;

import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;


@Entity
@Table(name="product")
@Getter
@Setter
@NoArgsConstructor
public class Product extends AbstractBaseEntity{
	
	@Builder
	public Product(Long id, String name, Integer version, String tenantId){
		super(tenantId);
		this.id = id;
		this.name = name;
		this.version = version;
	}
	@Id
	@Column(name = "id", unique = true, nullable = false, updatable = false)
	@SequenceGenerator(name = "product_seq", sequenceName = "product_seq")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "product_seq")
	protected Long id;
	
	@Column(name = "name", length = 255, nullable = false)
	@NotNull
	@Size(max = 255)
	private String name;
	
	@Version
	@Column(name = "version", nullable = false, columnDefinition = "int default 0")
	protected Integer version;
	
	
	
	
	
	
}
